import {
    reqmemberlist,
    reqmemberinfo,
} from "../../request/api.js"
const state = {
    info: {
        isshow: false,
        isadd: true
    },
    memberlist: [],
    memberinfo: [],
}
const getters = {
    info(state) {
        return state.info
    },
    memberlist(state) {
        return state.memberlist
    },
    memberinfo(state) {
        return state.memberinfo
    },
}
const mutations = {
    changeinfo(state, data) {
        state.info = data
    },
    memberlist(state, data) {
        state.memberlist = data
    },
    memberinfo(state, data) {
        state.memberinfo = data
    },

}
const actions = {
    memberlist(context) {
        reqmemberlist(context.state.reqpage).then(res => {
            context.commit("memberlist", res.data.list)
        })
    },
    memberinfo(context, data) {
        reqmemberinfo(data).then(res => {
            res.data.list.password = "";
            res.data.list.uid = data.uid
            context.commit("memberinfo", res.data.list)
        })
    },
}
export default {
    state,
    getters,
    mutations,
    actions,
    namespaced: true
}